package com.coderising.jvm.util;

public class Util {

	public static String byteToHexString(byte[] bytes) {
		
		StringBuilder builder =new StringBuilder();
		for(int i=0; i<bytes.length; i++){
			
			int value=bytes[i] &0xff;
			String hexString = Integer.toHexString(value);
			
			if(hexString.length()<2){
				builder.append("0");
			}
			
			builder.append(hexString);
		} 
		
		return builder.toString();
	}
	
public static Integer byte2ToInteger(byte[] bytes) {
	
			int value=((bytes[0]&0xff)<<8)+(bytes[1] &0xff);
		return value;
	}

}
